<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" >

	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
	<link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet">
	<link href="https://fonts.googleapis.com/css?family=Cousine|Inconsolata" rel="stylesheet">
	<link rel="shortcut icon" type="image/png" href="/favicon.png">

	
	<link rel="stylesheet" href="/css/style.css">
	<link rel="stylesheet" href="/css/css/fontawesome-all.min.css">
	<script src="/js/main.js"></script>
	

	<!-- Begin Jekyll SEO tag v2.1.0 -->
<title>Tutorials - Steem Developer</title>
<meta property="og:title" content="Tutorials" />
<meta name="description" content="Steem Developer Documentation." />
<meta property="og:description" content="Steem Developer Documentation." />
<link rel="canonical" href="https://developer.steem.io/unused/tutorials" />
<meta property="og:url" content="https://developer.steem.io/unused/tutorials" />
<meta property="og:site_name" content="Steem Developer" />
<script type="application/ld+json">
{"@context": "http://schema.org",
"@type": "WebPage",
"headline": "Tutorials",
"description": "Steem Developer Documentation.",
"url": "https://developer.steem.io/unused/tutorials"}</script>
<!-- End Jekyll SEO tag -->


	
</head>
<body>
<header>
	<h1>
		<button type="button" class="open-nav" id="open-nav"></button>
		<a href="/"  class="logo-link"><img src="/images/logotype_white.svg" height="40" alt="Steem Developer logo"></a>
	</h1>

	
	<form action="/search/" method="get">
		<input type="text" name="q" id="search-input" placeholder="Search">
		<input type="submit" value="Search" style="display: none;">
	</form>
	

	<div id="sidebar" class="sidebar">
	
	
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/">
		<h6 class="ctrl-nav-section title">Introduction</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/#introduction-welcome">Welcome to Steem</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/quickstart/">
		<h6 class="ctrl-nav-section title">Quickstart</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/quickstart/#quickstart-choose-library">Choose Library</a></li>
						
					
						
						<li><a href="/quickstart/#quickstart-steemd-nodes">steemd Nodes</a></li>
						
					
						
						<li><a href="/quickstart/#quickstart-testnet">Steem Testnet</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/tutorials/">
		<h6 class="ctrl-nav-section title">Tutorials</h6>
		<ul class="cont-nav-section content">
			
				
					
						<li><a href="/tutorials/#tutorials-javascript">Javascript</a></li>
					
				
					
						<li><a href="/tutorials/#tutorials-python">Python</a></li>
					
				
					
						<li><a href="/tutorials/#tutorials-ruby">Ruby</a></li>
					
				
					
						<li><a href="/tutorials/#tutorials-recipes">Recipes</a></li>
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/services/">
		<h6 class="ctrl-nav-section title">Services</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/services/#services-steemit">Steemit.com</a></li>
						
					
						
						<li><a href="/services/#services-steemconnect">SteemConnect</a></li>
						
					
						
						<li><a href="/services/#services-jussi">jussi</a></li>
						
					
						
						<li><a href="/services/#services-imagehoster">ImageHoster</a></li>
						
					
						
						<li><a href="/services/#services-sbds">SBDS</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/apidefinitions/">
		<h6 class="ctrl-nav-section title">Appbase API</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/apidefinitions/#apidefinitions-condenser-api">Condenser Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-account-by-key-api">Account By Key Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-broadcast-ops-comment">Broadcast Ops Comment</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-account-history-api">Account History Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-database-api">Database Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-follow-api">Follow Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-jsonrpc">Jsonrpc</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-market-history-api">Market History Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-network-broadcast-api">Network Broadcast Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-tags-api">Tags Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-witness-api">Witness Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-block-api">Block Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-broadcast-ops">Broadcast Ops</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/community/">
		<h6 class="ctrl-nav-section title">Community</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/community/#community-overview">Overview</a></li>
						
					
						
						<li><a href="/community/#community-resources">Resources</a></li>
						
					
						
						<li><a href="/community/#community-developeradvocate">Sharing & Help</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/glossary/">
		<h6 class="ctrl-nav-section title">Glossary</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/glossary/#glossary-chain-basics">Chain Basics</a></li>
						
					
						
					
						
						<li><a href="/glossary/#glossary-governance">Governance</a></li>
						
					
						
						<li><a href="/glossary/#glossary-transactions">Transactions</a></li>
						
					
						
						<li><a href="/glossary/#glossary-api">API</a></li>
						
					
						
						<li><a href="/glossary/#glossary-market">Market</a></li>
						
					
				
			
		</ul>
	</section>
	
</div>


	<!--<p class="copyright">-->
	<!--<a href="https://steemit.com.com/">-->
	<!--steemit-->
	<!--</a>-->
	<!--</p>-->
	<link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet">
</header>
<div class="main" id="top">
	<div class="hero">
		<h1 class="hero__h1">Steem Developer Portal </h1>
		
		<img class="hero__img" src="/images/hero.png">
		
	</div>
	<h5 id="steem-py-examples"><strong>steem-py examples</strong></h5>
<p>Install steem-py:</p>

<div class="highlighter-rouge"><pre class="highlight"><code>$ sudo apt-get install libffi-dev libssl-dev python-dev python3-pip
$ pip3 install steem
</code></pre>
</div>

<h5 id="auto-reply-bot">Auto Reply Bot</h5>
<p>The most easy auto-reply bot can be coded with just a few lines of code:</p>

<h5 id="block-stream">Block Stream</h5>
<p>This module allows to stream blocks and individual operations from the blockchain and run bots with a minimum of code. 
This example code shows all comments starting at block 1893850.</p>

<h5 id="operation-stream">Operation Stream</h5>
<p>Example for operation Stream:</p>

<h5 id="decentralized-exchange">Decentralized Exchange</h5>
<p>Example for decentralized exchange:</p>

<div title="Auto Reply Bot" class="language-python highlighter-rouge"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">steem</span> <span class="kn">import</span> <span class="n">Steem</span>
<span class="kn">import</span> <span class="nn">os</span>
<span class="kn">import</span> <span class="nn">json</span>
<span class="n">steem</span> <span class="o">=</span> <span class="n">Steem</span><span class="p">(</span><span class="n">wif</span><span class="o">=</span><span class="s">"&lt;posting-key-for-default-author&gt;"</span><span class="p">)</span>
<span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="n">steem</span><span class="o">.</span><span class="n">stream_comments</span><span class="p">():</span>
<span class="k">if</span> <span class="s">"Anything you want"</span> <span class="ow">in</span> <span class="n">c</span><span class="p">[</span><span class="s">"body"</span><span class="p">]:</span>
    <span class="k">print</span><span class="p">(</span><span class="n">c</span><span class="o">.</span><span class="n">reply</span><span class="p">(</span><span class="s">".. anything you want"</span><span class="p">))</span>
</code></pre>
</div>

<div title="Block Stream" class="language-python highlighter-rouge"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">steem.blockchain</span> <span class="kn">import</span> <span class="n">Blockchain</span>
<span class="kn">from</span> <span class="nn">pprint</span> <span class="kn">import</span> <span class="n">pprint</span>

<span class="k">for</span> <span class="n">a</span> <span class="ow">in</span> <span class="n">blockchain</span><span class="o">.</span><span class="n">blocks</span><span class="p">()</span>
    <span class="n">pprint</span><span class="p">(</span><span class="n">a</span><span class="p">)</span>
</code></pre>
</div>

<div title="Opereation Stream" class="language-python highlighter-rouge"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">steem.blockchain</span> <span class="kn">import</span> <span class="n">Blockchain</span>
<span class="kn">from</span> <span class="nn">pprint</span> <span class="kn">import</span> <span class="n">pprint</span>

<span class="k">for</span> <span class="n">a</span> <span class="ow">in</span> <span class="n">blockchain</span><span class="o">.</span><span class="n">ops</span><span class="p">()</span>
    <span class="n">pprint</span><span class="p">(</span><span class="n">a</span><span class="p">)</span>
</code></pre>
</div>

<div title="Decentralized Exchange" class="language-python highlighter-rouge"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">pprint</span> <span class="kn">import</span> <span class="n">pprint</span>
<span class="kn">from</span> <span class="nn">steem</span> <span class="kn">import</span> <span class="n">Steem</span>
<span class="kn">from</span> <span class="nn">steem.dex</span> <span class="kn">import</span> <span class="n">Dex</span>

<span class="n">steem</span> <span class="o">=</span> <span class="n">Steem</span><span class="p">()</span>
<span class="n">dex</span> <span class="o">=</span> <span class="n">Dex</span><span class="p">(</span><span class="n">steem</span><span class="p">)</span>
<span class="n">pprint</span><span class="p">(</span><span class="n">dex</span><span class="o">.</span><span class="n">buy</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="s">"SBD"</span><span class="p">,</span> <span class="mi">100</span><span class="p">))</span>
<span class="n">pprint</span><span class="p">(</span><span class="n">dex</span><span class="o">.</span><span class="n">sell</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="s">"SBD"</span><span class="p">,</span> <span class="mi">100</span><span class="p">))</span>
<span class="n">pprint</span><span class="p">(</span><span class="n">dex</span><span class="o">.</span><span class="n">cancel</span><span class="p">(</span><span class="s">"24432422"</span><span class="p">))</span>
<span class="n">pprint</span><span class="p">(</span><span class="n">dex</span><span class="o">.</span><span class="n">returnTicker</span><span class="p">())</span>
<span class="n">pprint</span><span class="p">(</span><span class="n">dex</span><span class="o">.</span><span class="n">return24Volume</span><span class="p">())</span>
<span class="n">pprint</span><span class="p">(</span><span class="n">dex</span><span class="o">.</span><span class="n">returnOrderBook</span><span class="p">(</span><span class="mi">2</span><span class="p">))</span>
<span class="n">pprint</span><span class="p">(</span><span class="n">dex</span><span class="o">.</span><span class="n">ws</span><span class="o">.</span><span class="n">get_order_book</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="n">api</span><span class="o">=</span><span class="s">"market_history"</span><span class="p">))</span>
<span class="n">pprint</span><span class="p">(</span><span class="n">dex</span><span class="o">.</span><span class="n">returnTradeHistory</span><span class="p">())</span>
<span class="n">pprint</span><span class="p">(</span><span class="n">dex</span><span class="o">.</span><span class="n">returnMarketHistoryBuckets</span><span class="p">())</span>
<span class="n">pprint</span><span class="p">(</span><span class="n">dex</span><span class="o">.</span><span class="n">returnMarketHistory</span><span class="p">(</span><span class="mi">300</span><span class="p">))</span>
<span class="n">pprint</span><span class="p">(</span><span class="n">dex</span><span class="o">.</span><span class="n">get_lowest_ask</span><span class="p">())</span>
<span class="n">pprint</span><span class="p">(</span><span class="n">dex</span><span class="o">.</span><span class="n">get_higest_bid</span><span class="p">())</span>
<span class="n">pprint</span><span class="p">(</span><span class="n">dex</span><span class="o">.</span><span class="n">transfer</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="s">"SBD"</span><span class="p">,</span> <span class="s">"fabian"</span><span class="p">,</span> <span class="s">"foobar"</span><span class="p">))</span>
</code></pre>
</div>


</div>
<div class="footer">
	<a href="#">Back to top</a>
</div>
<script>
    document.getElementById("open-nav").addEventListener("click", function () {
        document.body.classList.toggle("nav-open");
    });
</script>
</body>
</html>


<script src="/js/adjust.js"></script>

